<html>
<head>
<link rel='stylesheet' href='../../../js/sh/SyntaxHighlighter.css' type='text/css' />
<script src='../../../js/sh/shCore.js'></script>
<script src='../../../js/sh/shBrushJava.js'></script>
<style>
* {
font-family:Courier New,monospace;
  padding: 0;
  margin: 0;
  white-space: nowrap;
  font-size: 11px;
}
.dp-highlighter {
  white-space: nowrap;
  overflow: visible;
  width: 600px;
  font-size: 11px;
  font-family:Courier New,monospace;
}
</style>
</head>
<body>
<textarea name='code' class='java:nogutter' rows='15' cols='120'>
/*
 * SmartGWT (GWT for SmartClient)
 * Copyright 2008 and beyond, Isomorphic Software, Inc.
 *
 * SmartGWT is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3
 * as published by the Free Software Foundation.  SmartGWT is also
 * available under typical commercial license terms - see
 * http://smartclient.com/license
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 */

import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.DragDataAction;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HStack;
import com.smartgwt.client.widgets.layout.VStack;
import com.smartgwt.sample.showcase.client.data.PartData;

public class DragListMoveSample implements EntryPoint {

    public void onModuleLoad() {
        HStack hStack = new HStack(10);
        hStack.setHeight(160);

        final PartsListGrid myList1 = new PartsListGrid();
        myList1.setCanDragRecordsOut(true);
        myList1.setCanAcceptDroppedRecords(true);
        myList1.setCanReorderFields(true);
        myList1.setDragDataAction(DragDataAction.MOVE);
        myList1.setData(PartData.getRecords());
        hStack.addMember(myList1);

        final PartsListGrid myList2 = new PartsListGrid();
        myList2.setCanDragRecordsOut(true);
        myList2.setCanAcceptDroppedRecords(true);
        myList2.setCanReorderRecords(true);

        VStack vStack = new VStack(10);
        vStack.setWidth(32);
        vStack.setHeight(74);
        vStack.setLayoutAlign(Alignment.CENTER);

        Img rightImg = new Img("icons/32/arrow_right.png", 32, 32);
        rightImg.setLayoutAlign(Alignment.CENTER);
        rightImg.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                myList2.transferSelectedData(myList1);
            }
        });
        vStack.addMember(rightImg);

        Img leftImg = new Img("icons/32/arrow_left.png", 32, 32);
        leftImg.setLayoutAlign(Alignment.CENTER);
        leftImg.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                myList1.transferSelectedData(myList2);
            }
        });
        vStack.addMember(leftImg);

        hStack.addMember(vStack);
        hStack.addMember(myList2);

        hStack.draw();
    }

}
</textarea>
<script class='javascript'>
dp.SyntaxHighlighter.HighlightAll("code");
</script>
</body>
</html>
